package com.csdj.server.test;


import java.sql.Connection;
import java.sql.DriverManager;

public class BaseConnection {

    public static void main(String [] args)
    {
        String driverName="com.mysql.cj.jdbc.Driver";
        String dbURL="jdbc:mysql://localhost:3306/yeb?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai";  // 我的数据库名 Test

        String userName="root";   // 填写你的用户名
        String userPwd="root";   // 填写你的密码

        try
        {
            Class.forName(driverName);
            Connection dbConn= DriverManager.getConnection(dbURL,userName,userPwd);
            System.out.println("连接数据库成功");
        }
        catch(Exception e)
        {
            e.printStackTrace();
            System.out.print("连接失败");
        }
    }
}

